# -*- coding: utf-8
import random, time
import hashlib

count = 1  # total rows: K
count_f = 5  # total feature counts

fileX = open("data_X_" + str(count) + "K_" + str(count_f) + "f.txt", mode='w')
fileY = open("data_Y_" + str(count) + "K_" + str(count_f) + "f.txt", mode='w')

# line_1_x="idX,x-null,x-null2"
# line_1_y="idY,yTest,y-null,y-null2"
line_1_x = "idX"
line_1_y = "idY,yTest"
for i in range(count_f):
    line_1_x += ",x" + str(i)
    line_1_y += ",y" + str(i)
line_1_x += "\n"
line_1_y += "\n"
fileX.write(line_1_x)
fileY.write(line_1_y)

for i in range(count * 1000):
    # while X file
    # if i%2 == 1 :
    #     continue

    id_hash = hashlib.md5(str(i).encode(encoding='UTF-8')).hexdigest()
    line_tmp_x = id_hash  # X样本

    y_r = str(random.randint(0, 1))
    line_tmp_y = id_hash + "," + y_r

    for j in range(count_f):
        a = round(random.uniform(-2, 2), 8)
        line_tmp_x += "," + str(a)
        line_tmp_y += "," + str(a)
    line_tmp_x += "\n"
    line_tmp_y += "\n"
    fileX.write(line_tmp_x)
    fileY.write(line_tmp_y)

fileX.close()
fileY.close()
